﻿using System;
using System.Collections.Generic;
using System.Linq;
using CVsharp.Models.Entities;

namespace CVsharp.Models.DAL.Account
{
    public class SysMenuNode:Interface.IsysMenuNode
    {
        public IList<sysMenuNode> GetAll()
        {
            using (DBEntities db = new DBEntities())
            {
                return db.sysMenuNode.ToList<sysMenuNode>();
            }
        }

        public IList<Guid> GetByUser(Guid userId)
        {
            using (DBEntities db = new DBEntities())
            {
                List<Guid> list = (from g in db.sysUsersInMnuNode
                                   where g.UserId == userId
                                   select g.sysMenuNode.MenuNodeId).ToList();
                Console.WriteLine(db.sysUsersInMnuNode.ToTraceString());
                return list;
            }
        }
    }
}
